//
//  BSZNViewController.m
//  Hxcsfw
//
//  Created by qiysoft on 2017/12/27.
//  Copyright © 2017年 企友软mac. All rights reserved.
//

#import "BSZNViewController.h"
#import "CouseSeachListView.h"
#import "AnswerSortListViewController.h"

@interface BSZNViewController ()<CouseSeachListViewDelegate>
{
    CouseSeachListView *seachView;
    int m;
    int n;
}
@property (nonatomic,copy) NSString *level1;
@property (nonatomic,copy) NSString *level2;
@property (nonatomic,copy) NSString *level3;
@property (nonatomic,strong) NSArray *BSZNArray;

@end

@implementation BSZNViewController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
    _BSZNArray = @[@{@"children":@[@{@"level3":@"swdj",@"value":@"税务登记"},@{@"level3":@"swrd",@"value":@"税务认定"},@{@"level3":@"fpbl",@"value":@"发票办理"},@{@"level3":@"sbns",@"value":@"申报纳税"},@{@"level3":@"yhbl",@"value":@"优惠办理"},@{@"level3":@"zmbl",@"value":@"证明办理"}],@"level2":@"note",@"value":@"办税指南"}];
    [WShareUtil sharedData].arrList = _BSZNArray;
    
    if (seachView == nil) {
        
        if (XIPHONE) {
            seachView = [[CouseSeachListView alloc]initWithFrame:CGRectMake(0, 0, WSCREENH_WIDTH, WSCREENH_HEIGHT - 49 - 64 - 50)];
        }else{
            seachView = [[CouseSeachListView alloc]initWithFrame:CGRectMake(0, 0, WSCREENH_WIDTH, WSCREENH_HEIGHT - 49 - 64)];
        }
        
        seachView.delegate = self;
        [self.view addSubview:seachView];
    }
}
- (void)viewDidLoad {
    [super viewDidLoad];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)btnOfpassValueClicked:(UIButton *)sender {
    
    _level1 = @"note";
    WLog(@"%ld",(long)sender.tag);
    
    NSString *tagStr = [NSString stringWithFormat:@"%ld",(long)sender.tag];
    m = [[tagStr substringToIndex:1] intValue] - 1;
    n = [[tagStr substringFromIndex:tagStr.length-1] intValue];
    
    WLog(@"十位-%d",m);
    WLog(@"个位-%d",n);
    
    _level2 = [_BSZNArray[m] objectForKey:@"level2"];
    NSArray *arr = [_BSZNArray[m] objectForKey:@"children"];
    _level3 = [arr[n] objectForKey:@"level3"];
    //    _level3 = [[[WShareUtil sharedData].arrList[0] objectForKey:@"children"][0] objectForKey:@"level3"];
    
    WLog(@"_level1-%@",_level1);
    WLog(@"_level2-%@",_level2);
    WLog(@"_level3-%@",_level3);
    
    AnswerSortListViewController *aslVC = [[AnswerSortListViewController alloc]init];
    aslVC.level1 = _level1;
    aslVC.level2 = _level2;
    aslVC.level3 = _level3;
    aslVC.navTitle = [arr[n] objectForKey:@"value"];
    [self.navigationController pushViewController:aslVC animated:YES];
}

//点击隐藏list搜索
- (void)btnOfDisappearClicked {
}

@end
